class Global_Context(object):
    _dic = {}

    # TODO 2 : 通过key去进行获取数据
    def get_dic(self, key):
        # 如果这个key不存在,则会报错-不推荐
        # return self._dic[key]
        return self._dic.get(key, None)

    # TODO 1 : 通过key去进行设置
    def set_dic(self, key, value):
        self._dic[key] = value

    # TODO 3 : 通过字典去设置数据
    def set_by_dict(self, dic):
        self._dic.update(dic)

    # TODO 4 : 显示对应全局变量
    def show_dict(self):
        return self._dic

# Global_Context = Global_Context()
#
# Global_Context.set_dic("name", "whh")
# name = Global_Context.get_dic("name")
# print(name)
#
# print(Global_Context.show_dict())
#
# data = {"token": "123456"}
# Global_Context.set_by_dict(data)
# print(Global_Context.show_dict())
